package com.iotechn.unimall.admin.api.integral;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.data.domain.IntegralGoodsDO;
import com.iotechn.unimall.data.domain.SkuDO;
import com.iotechn.unimall.data.dto.integralactivity.IntegralGoodsAppDTO;
import com.iotechn.unimall.data.model.Page;

import java.util.List;

/**
 * 后台积分管理
 *
 * @author kyms
 * @date 2020-07-31 17:02
 */
@HttpOpenApi(group = "admin.integralgoods", description = "后台积分管理")
public interface AdminIntegralGoodsService {
    @HttpMethod(description = "添加", permission = "operation:integral:add", permissionParentName = "运营管理", permissionName = "积分管理")
    IntegralGoodsDO addIntegralGoods(@HttpParam(name = "goods") IntegralGoodsDO integralGoodsDO, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;


    @HttpMethod(description = "编辑", permission = "operation:integral:update", permissionParentName = "运营管理", permissionName = "积分管理")
    IntegralGoodsDO updateIntegralGoods(@HttpParam(name = "goods") IntegralGoodsDO integralGoodsDO, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "分页", permission = "operation:integral:page", permissionParentName = "运营管理", permissionName = "积分管理")
    Page<IntegralGoodsDO> pageIntegralGoods(@HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
                                            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页长度", valueDef = "20") Integer limit,
                                            @HttpParam(name = "search", description = "商品名称或条码") String search,
                                            @HttpParam(name = "type", description = "兑换规则类型(1:纯积分 2:积分+现金 3:积分兑优惠券") Integer type,
                                            @HttpParam(name = "startTime", type = HttpParamType.COMMON, description = "开始时间") String startTime,
                                            @HttpParam(name = "endTime", type = HttpParamType.COMMON, description = "结束时间") String endTime,
                                            @HttpParam(name = "status", type = HttpParamType.COMMON, description = "状态") Integer status,
                                            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "上/下架", permission = "operation:integral:shelve", permissionParentName = "运营管理", permissionName = "积分管理")
    IntegralGoodsDO shelveIntegralGoods(@HttpParam(name = "id", description = "id") Long id, @HttpParam(name = "status", description = "状态") Integer status, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "搜索商品sku")
    List<SkuDO> searchSku(@HttpParam(name = "search", description = "搜索") String search, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId);

    @HttpMethod(description = "列出优惠券")
    List<SkuDO> listCouponAsSku(@HttpParam(name = "status", description = "状态") Integer status, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId);

    @HttpMethod(description = "商品详情")
    SkuDO detailGoods(@HttpParam(name = "id", description = "id") Long id, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId);


    @HttpMethod(description = "详情")
    IntegralGoodsAppDTO detail(@HttpParam(name = "id") Long id, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "开启")
    IntegralGoodsDO start(@HttpParam(name = "id", description = "id") Long id, @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "查询重复优惠券")
    public Integer checkCoupon(
            @HttpParam(name = "couponId", description = "优惠券id") Long couponId
    )throws ServiceException ;
}
